from django.db import models

# Create your models here.


class Image(models.Model):
    img = models.ImageField(upload_to='imgs')
    name = models.CharField(max_length=20)

class Usermsg(models.Model):
    name = models.CharField(max_length=50)
    pwd = models.CharField(max_length=20)
    email = models.EmailField()
    phone = models.CharField(max_length=20)
    privilege = models.IntegerField()
    sex = models.CharField(max_length=10)
    articles = models.IntegerField()  # 文章数
    visits = models.IntegerField()  # 访问数
    icon = models.ImageField(upload_to='user_icons')
    icon_name = models.CharField(max_length=50)


class Article(models.Model):
    title = models.CharField(max_length=200)
    author = models.CharField(max_length=50)
    detail = models.CharField(max_length=300)
    content = models.TextField()    # 文章内容
    uid = models.IntegerField()     # 作者ID
    tid = models.IntegerField()
    visits = models.IntegerField()  # 访问数
    comments = models.IntegerField()    # 评论数
    atype = models.CharField(max_length=50)  # 文章类型

class Typemsg(models.Model):
    typename = models.CharField(max_length=50)

class Comment(models.Model):
    uid = models.IntegerField()
    content = models.TextField()
    aid = models.IntegerField() # article id
